#! /bin/sh

#---------------------------------------------------------------------
#                           chicken and egg                           
#---------------------------------------------------------------------

test -f "${FW_ROOT}/share/fw/sh/fw-find.sh" && fws="${FW_ROOT}/share/fw/sh/fw-find.sh"
test -f "fw/sh/fw-find.sh" && fws="fw/sh/fw-find.sh"
test -f "fw.local/sh/fw-find.sh" && fws="fw.local/sh/fw-find.sh"
test ! -z "$fws" || {
  echo "package/deb/list-files: fatal: can't locate fw-find.sh" 1>&2
  exit 1
}

. "$fws"

#---------------------------------------------------------------------
#                              routines                               
#---------------------------------------------------------------------

fw_source "package/deb/list-files" "sh/fatal.sh"

#---------------------------------------------------------------------
#                                main                                 
#---------------------------------------------------------------------

which dpkg >/dev/null 2>/dev/null || {
  echo "package/deb/list-files: error: dpkg not installed" 1>&2
  fatal "package/deb/list-files"
}

dpkg --listfiles "$@"
